package com.dawan.sbjy.service.impl;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.dawan.sbjy.entity.User;
import com.dawan.sbjy.service.ifac.TokenMapper;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class TokenSerive implements TokenMapper {
    @Override
    public String getToken(Map user) {
        String token="";
        token= JWT.create().withAudience((String) user.get("username"))
                .sign(Algorithm.HMAC256((String) user.get("password")));
        return token;
    }
}
